package com.cx.config;

import com.cx.interceptor.UserLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class WebAppConfigurer implements WebMvcConfigurer {
//    @Autowired
//    UserLoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserLoginInterceptor()).addPathPatterns("/**").excludePathPatterns(urlPass());
    }

    public List<String> urlPass(){
        List<String> list = new ArrayList<>();

        list.add("http://localhost:63342/sdkd-parent/web/webapp/user/*");

        return list;
    }
}
